package ui.message;

import util.Time;

import javax.swing.*;
import java.awt.*;
import java.util.concurrent.TimeUnit;

public class MessageItem extends JPanel{

    private JLabel lbl_sender;
    private JLabel lbl_time;
    private JLabel lbl_myEvaluation;
    private JLabel lbl_bidInfo;
    private JLabel lbl_comment;

    public MessageItem(String sender, String time, double evaluation, String bidInfo, String comment){
        lbl_sender = new JLabel(sender);
        lbl_time = new JLabel(time);
        lbl_myEvaluation = new JLabel(String.valueOf(evaluation));
        lbl_bidInfo = new JLabel(bidInfo);
        lbl_comment = new JLabel(comment);

        this.setLayout(new GridBagLayout());
        this.setBackground(Color.LIGHT_GRAY);


        this.add(lbl_sender);
        this.add(lbl_time);
        this.add(lbl_myEvaluation);
        this.add(lbl_bidInfo);
        this.add(lbl_comment);

    }

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setContentPane(new MessageItem("you", Time.getHms(), 0.85, "A: a1; B: 150.5", "Such a good bid!"));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }

}
